package itb.nlp.postagger.hmm;


/*=======================================================================*
 * Copyright 2009-2010		                                             *
 * Alfan Farizki Wicaksono			                                     *
 * Institute of Technology Bandung, INDONESIA                            *
 *																	     *
 * This program is free software; you can redistribute it and/or modify  *
 * it under the terms of the GNU General Public License as published by  *
 * the Free Software Foundation; either version 2 of the License, or     *
 * (at your option) any later version.                                   *
 * 																		 *
 * This program is distributed in the hope that it will be useful,       *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 * GNU General Public License for more details.                          *
 *                                                                       *
 *=======================================================================*/
import itb.nlp.postagger.hmm.train.MainTrainer;
import itb.nlp.postagger.hmm.decoder.MainTagger;


import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

public class Test {

    public static void main(String args[]) {
        if (args[0].equals("train")) {
            MainTrainer.Train("./resource/Corpus.crp");
            //MainTrainer.Train("UI-1M-tagged.txt");
        } else if(args[0].equals("token")){
            int lm = Integer.parseInt(args[1]);
            int affix = Integer.parseInt(args[2]);
            int pass2 = Integer.parseInt(args[3]);
            int lex = Integer.parseInt(args[4]);

            MainTagger mt = new MainTagger("file:/D:/PROJECT/Riset/Virtual%20SME/Workspace/AlfanPosTagger/resources/Lexicon.trn",
                    "file:/D:/PROJECT/Riset/Virtual%20SME/Workspace/AlfanPosTagger/resources/Ngram.trn",
                    "file:/D:/PROJECT/Riset/Virtual%20SME/Workspace/AlfanPosTagger/resources/inlex.txt",
                    "file:/D:/PROJECT/Riset/Virtual%20SME/Workspace/AlfanPosTagger/resources/cattable.txt",
                    1);
            
            List<String> tokenList = new ArrayList<String>();
            tokenList.add("Alfan");
            tokenList.add("pergi");
            tokenList.add("ke");
            tokenList.add("kantor");
            tokenList.add("BPPT");
            tokenList.add("Bandar");
            tokenList.add("Lampung");
            List<String> tags = mt.taggingToken(tokenList);
            
            ListIterator<String> tagIterator = tags.listIterator();
            while(tagIterator.hasNext()){
                System.out.println(tagIterator.next());
            }
            
        } else {
            // java Test test2.tag LM AFFIX 2PASS LEX
            int lm = Integer.parseInt(args[1]);
            int affix = Integer.parseInt(args[2]);
            int pass2 = Integer.parseInt(args[3]);
            int lex = Integer.parseInt(args[4]);

//            MainTagger mt = new MainTagger("./resource/Lexicon.trn", "./resource/Ngram.trn", lm,
//                    3, 3,
//                    0, affix,
//                    false, 0.2,
//                    pass2, 500.0,
//                    lex);
//
//            //MainTagger mt = new MainTagger("Lexicon.trn", "Ngram.trn", 0);//0:Bigram, 1:Trigram
//
//            //hasil tagging ada di ArrayList
//            ArrayList<String> ret = mt.taggingFile(args[0]);
//
//            int i = 0;
//            for (i = 0; i < ret.size(); i++) {
//                System.out.print(ret.get(i) + " ");
//                if (ret.get(i).equals("./.")) {
//                    System.out.print("\n");
//                }
//            }
//            System.out.println("\n");
        }
    }
}
